import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "purchase_orders")
public class PurchaseOrder {
    @Id
    @Column(name = "采购订单ID")
    private String orderId;
    
    @Column(name = "采购时间")
    @Temporal(TemporalType.TIMESTAMP)
    private Date time;
    
    @Column(name = "采购数量")
    private Integer quantity;
    
    @Column(name = "采购金额")
    private Float amount;
    
    @Column(name = "供应商ID")
    private String supplierId;
    
    @ManyToOne
    @JoinColumn(name = "供应商ID", insertable = false, updatable = false)
    private Supplier supplier;
    
    @OneToMany(mappedBy = "purchaseOrder", cascade = CascadeType.ALL)
    private List<Purchase> purchases;
}